package ru.urfc.portal.ui.client.googlets.client;

import ru.urfc.portal.ui.client.BaseGooglet;
import ru.urfc.portal.ui.client.descriptor.GridDescriptor;
import ru.urfc.portal.ui.client.model.catalogs.DeviceState;
import ru.urfc.portal.ui.client.widgets.MegaGrid;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Widget;

public class DeviceStateChangeList extends BaseGooglet {

	@UiTemplate("RegularList.ui.xml")
	interface Binder extends UiBinder<Widget, DeviceStateChangeList> {}
	private static Binder binder = GWT.create(Binder.class);

	@UiField MegaGrid grid;
	@UiField Element title;
	
	@Override
	protected void init() {
		initWidget(binder.createAndBindUi(this));
		title.setInnerText("История изменения статуса РЭС");

		GridDescriptor descriptor = new GridDescriptor(DEVICE_STATE_CHANGE,
				CLIENTS, getClientId(), DEVICES, getItemId(), DEVICE_STATE_CHANGES);
		descriptor.addDateColumn("changeDate", "Дата", 100);
		descriptor.addCIColumn("state/text", "state/code", DeviceState.class, "Статус", 150);
		
		createController(descriptor, grid);
        grid.setWidth(252);
	}
	
}